A memory-safer wrapper around system dynamic library loading primitives.
Using this library allows loading [dynamic libraries](struct.Library.html) (also known as
shared libraries) as well as use functions and static variables these libraries contain.
While the library does expose a cross-platform interface to load a library and find stuff
inside it, little is done to paper over the platform differences, especially where library
loading is involved. The documentation for each function will attempt to document such
differences on the best-effort basis.
Less safe, platform specific bindings are also available. See the
[`os::platform`](os/index.html) module for details.
# Usage
Add dependency to this library to your `Cargo.toml`:
```toml
[dependencies]
libloading = "0.3"
```
Then inside your project
```no_run
extern crate libloading as lib;
fn call_dynamic() -> lib::Result {
let lib = try!(lib::Library::new("/path/to/liblibrary.so"));
unsafe {
let func: lib::Symbol u32> = try!(lib.get(b"my_func"));
Ok(func())
}
}
```
The compiler will ensure that the loaded `function` will not outlive the `Library` it comes
from, preventing a common cause of undefined behaviour and memory safety problems.